//
//  ByUIAppIndexMoreVC.m
//  chequanbao_ios
//
//  Created by mc on 2017/8/10.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByUIAppIndexMoreVC.h"
#import "ByCellMore.h"

@interface ByUIAppIndexMoreVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, copy)   NSArray *titlesAry;
@property (nonatomic, copy)   NSArray *imgAry;
@end

@implementation ByUIAppIndexMoreVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"更多美好";
    [self addLeftBackBarButtonItem];
    [self initTableview];
}

- (void)initTableview{
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64) style:UITableViewStyleGrouped];
    [self.view addSubview:_tableView];
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.backgroundColor = [UIColor clearColor];
    _tableView.scrollEnabled = NO;
    _tableView.estimatedRowHeight = 0;
    _tableView.estimatedSectionHeaderHeight = 0;
    _tableView.estimatedSectionFooterHeight = 0;
    _tableView.delegate = self;
    _tableView.dataSource = self;

}

-(NSArray *)titlesAry{
    if (!_titlesAry) {
        _titlesAry = @[@[@"安居乐业",@"互帮社区"],@[@"老有所依",@"M2C定制"]];
    }
    return _titlesAry;
}

-(NSArray *)imgAry{
    if (!_imgAry) {
        _imgAry = @[@[@"Index_ajly",@"Index_hbsq"],@[@"Index_lysy",@"Index_zgzj"]];
    }
    return _imgAry;
}


#pragma mark -
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ByCellMore *cell = [ByCellMore cellWithTableView:tableView titlesAry:self.titlesAry[indexPath.section] imgAry:self.imgAry[indexPath.section] indexPath:indexPath.section];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    CGFloat width = SCREEN_WIDTH - 2*10;
    return  width /2;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 0) {
        CGFloat width = SCREEN_WIDTH - 2*20;
        return (SCREEN_HEIGHT - 64 - 30 - (width / 2) * 2) / 2;
    }
    return 0.0001;
}



@end
